// Online C++ compiler to run C++ program online
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,p; cin>>n>>p; string s; cin>>s;
int it1=0; int it2=p;int b=0;
while(it2<n){
if(s[it1]=='.'||s[it2]=='.'){ b=1; break;}
if(s[it1]!=s[it2]){ b=1;break;}
it1++;it2++; }
if(b==0){ cout<<"NO"; return 0;}
unordered_map<char,char>m; m['0']='1';m['1']='0'; it1=0;it2=p;
for(int i=0;i<=p-1;i++){ if(s[i]=='.') {
if(i+p<n){ if(s[i+p]!='.') s[i]=m[s[i+p]]; else s[i]='0'; }
else{ s[i]='0'; } }
}
while(it2<n){
if(s[it2]=='.') { s[it2]=m[s[it1]];}
it1++; it2++;
}
cout<<s;
return 0;
}
1032. Stream of Characters | 987. Vertical Order Traversal of a Binary Tree |
952. Largest Component Size by Common Factor | 212. Word Search II |
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |